Skip to content

fix: deduplicate workspaceSearchPaths error and skip PET resolve for unresolved variables (Fixes #1289)#1290

Merged
aeschli merged 3 commits intomainfrom
fix/issue-1289
Feb 27, 2026
Merged

fix: deduplicate workspaceSearchPaths error and skip PET resolve for unresolved variables (Fixes #1289)#1290
aeschli merged 3 commits intomainfrom
fix/issue-1289

Conversation

@karthiknadig
Copy link
Member

@karthiknadig karthiknadig commented Feb 27, 2026

Fix noisy startup errors reported in #1289.

  • Add module-level workspaceSearchPathsGlobalWarningShown flag so the workspaceSearchPaths global-level error is logged at most once per session
  • Check for unresolved variables (${...}) in defaultInterpreterPath after resolveVariables() and skip PET resolve call, falling through to auto-discovery with a clear warning
  • Localize the SettingResolutionError.reason for unresolved variables since it's surfaced to users via notifyUserOfSettingErrors()
  • Export resetWorkspaceSearchPathsGlobalWarningFlag() for test isolation
  • Add test: "should skip native resolution when defaultInterpreterPath has unresolved variables"
  • Add test: "Global workspace setting warning is only logged once across multiple calls"

Fixes #1289

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reduces noisy startup logs in the Python Environments extension by deduplicating repeated workspaceSearchPaths scope warnings and avoiding PET/native resolution when python.defaultInterpreterPath still contains unresolved ${...} variables, falling back cleanly to auto-discovery.

Changes:

  • Deduplicate the global-scope workspaceSearchPaths misconfiguration log to once per session and add a reset helper for test isolation.
  • Skip native/PET resolution when defaultInterpreterPath contains unresolved variables after resolveVariables(), and record a distinct failure reason.
  • Add unit tests covering the deduped log behavior and the unresolved-variables fallback path.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/managers/common/nativePythonFinder.ts Adds a module-level “already logged” flag for global-scope workspaceSearchPaths warnings plus a reset helper.
src/features/interpreterSelection.ts Detects unresolved ${...} in defaultInterpreterPath and skips native resolution, falling back to auto-discovery with clearer error reasons.
src/test/managers/common/nativePythonFinder.getAllExtraSearchPaths.unit.test.ts Resets the new flag for isolation and adds a test ensuring the global-scope warning is logged only once across calls.
src/test/features/interpreterSelection.unit.test.ts Adds a test ensuring native resolution is skipped when unresolved variables remain in defaultInterpreterPath.

@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Feb 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +126 to +130
const error: SettingResolutionError = {
setting: 'defaultInterpreterPath',
configuredValue: userInterpreterPath,
reason: `Could not resolve interpreter path '${userInterpreterPath}'`,
};
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SettingResolutionError.reason is surfaced to users via notifyUserOfSettingErrors() (it gets interpolated into the localized showWarningMessage() string). In this branch the reason is still a hard-coded English string (and other reasons in this flow are a mix of localized/unlocalized), which will show up unlocalized in non-English VS Code installs. Please localize this reason (and ideally make the approach consistent for all SettingResolutionError.reason values, e.g., store a reason code and localize at display time).

Copilot uses AI. Check for mistakes.
@aeschli aeschli merged commit b3a23df into main Feb 27, 2026
126 of 127 checks passed
@aeschli aeschli deleted the fix/issue-1289 branch February 27, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Noisy startup errors: workspaceSearchPaths warning spam and unresolved ${workspaceFolder} sent to PET

3 participants